#pragma once

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QMessageBox>
#include <QFile>

class HttpGet  : public QObject
{
	Q_OBJECT

public:
	HttpGet(QObject *parent = nullptr);
	~HttpGet();

	void post(std::function<void(QByteArray&)> callBack, const QUrl& url, const std::unordered_map<QNetworkRequest::KnownHeaders, std::string>& headers, const QString& content);

	void get(std::function<void(QByteArray&)> callBack, const QUrl& url, const std::unordered_map<QNetworkRequest::KnownHeaders, std::string>& headers);

private:
	QNetworkAccessManager* m_manager;
	QNetworkRequest* m_request;
	QNetworkReply* m_reply;
};
